In [1]:
# Avoiding ValueError: ('range parameter must be finite.', u'occurred at index 6.0')
# The newer version of numpy throws an error when I try to run vanhove
# (or any histogram function) on data with NaN.
## conda install numpy=1.10.4
## conda install -c soft-matter trackpy=0.3.0
import pkg_resources
pkg_resources.require("numpy==1.10.4")
#pkg_resources.require("trackpy==0.3.0")
import numpy as np
import trackpy as tp
print(np.__version__)
print(tp.__version__)
In [2]:
%matplotlib inline
# Import all the programs we want to use. If this gives an error, then you need to add these to your python path.
import matplotlib as mpl
import matplotlib.pyplot as plt
#import numpy as np
import pandas as pd
from pandas import DataFrame, Series # for convenience
import pims
import trackpy as tp
#import holopy as hp
import os
#import av
import scipy
import scipy.optimize as sco
import seaborn
%pylab inline
# tell python how to display images
#%matplotlib notebook
#tp.__version__
In [3]:
scaling = 0.08431 #um/pixel
moviename = "manualnorm,tracer+janus_3%_H2O2_5,2016-06-14"
In [4]:
os.chdir("\\\\manoharanfs1.rc.fas.harvard.edu\\manoharanfs1\\zchambers\\analysis\\2016-06-14\\tracer+Janus_no_H2O2_3_emulsion_red_2016-06-14")
tmnr = pd.read_pickle('filtered_data_with_drift_subtracted_tracer+janus_no_H2O2_3(red)2016-06-14_pickled.pkl')
#read pickle file for tracer particles with no H2O2
tmnr.head()
Out[4]:
In [5]:
os.chdir("\\\\manoharanfs1.rc.fas.harvard.edu\\manoharanfs1\\zchambers\\analysis\\2016-06-14\\tracer+Janus_no_H2O2_3_emulsion_green_2016-06-14")
tmng = pd.read_pickle('filtered_data_with_drift_subtracted_tracer+janus_no_H2O2_3(green)2016-06-14_pickled.pkl')
#read pickle file for janus particles with no H2O2
tmng.head()
Out[5]:
In [6]:
os.chdir("\\\\manoharanfs1.rc.fas.harvard.edu\\manoharanfs1\\zchambers\\analysis\\2016-06-14\\tracer+Janus_3%_H2O2_5_emulsion_red_2016-06-14")
tmhr = pd.read_pickle('filtered_data_with_drift_subtracted_tracer+janus_3%_H2O2_5(red)2016-06-14_pickled.pkl')
#read pickle file for tracer particles with 3% H2O2
tmhr.head()
Out[6]:
In [7]:
os.chdir("\\\\manoharanfs1.rc.fas.harvard.edu\\manoharanfs1\\zchambers\\analysis\\2016-06-14\\tracer+Janus_3%_H2O2_5_emulsion_green_2016-06-14")
tmhg = pd.read_pickle('filtered_data_with_drift_subtracted_tracer+janus_3%_H2O2_5(green)2016-06-14_pickled.pkl')
#read pickle file for janus particles with 3% H2O2
tmhg.head()
Out[7]:
In [8]:
posnrx = tmnr.set_index(['frame','particle'])['x'].unstack()
# This function takes the x position of the particle and arranges it by frame
posnrx.head()
Out[8]:
In [9]:
poshrx = tmhr.set_index(['frame','particle'])['x'].unstack()
# This function takes the x position of the particle and arranges it by frame
In [10]:
posngx = tmng.set_index(['frame','particle'])['x'].unstack()
# This function takes the x position of the particle and arranges it by frame
In [11]:
poshgx = tmhg.set_index(['frame','particle'])['x'].unstack()
# This function takes the x position of the particle and arranges it by frame
In [12]:
posnry = tmnr.set_index(['frame','particle'])['y'].unstack()
# This function takes the y position of the particle and arranges it by frame
In [13]:
poshry = tmhr.set_index(['frame','particle'])['y'].unstack()
# This function takes the y position of the particle and arranges it by frame
In [14]:
posngy = tmng.set_index(['frame','particle'])['y'].unstack()
# This function takes the y position of the particle and arranges it by frame
In [15]:
poshgy = tmhg.set_index(['frame','particle'])['y'].unstack()
# This function takes the x position of the particle and arranges it by frame
In [16]:
binwidth = 0.05
binsequence=arange(-10,10,binwidth)
In [17]:
vh1nrx = tp.motion.vanhove(posnrx, lagtime = 6, mpp = scaling,bins = binsequence, ensemble = True)
vh1ngx = tp.motion.vanhove(posngx, lagtime = 6, mpp = scaling,bins = binsequence, ensemble = True)
vh1nry = tp.motion.vanhove(posnry, lagtime = 6, mpp = scaling,bins = binsequence, ensemble = True)
vh1ngy = tp.motion.vanhove(posngy, lagtime = 6, mpp = scaling,bins = binsequence, ensemble = True)
vh1hrx = tp.motion.vanhove(poshrx, lagtime = 6, mpp = scaling,bins = binsequence, ensemble = True)
vh1hgx = tp.motion.vanhove(poshgx, lagtime = 6, mpp = scaling,bins = binsequence, ensemble = True)
vh1hry = tp.motion.vanhove(poshry, lagtime = 6, mpp = scaling,bins = binsequence, ensemble = True)
vh1hgy = tp.motion.vanhove(poshgy, lagtime = 6, mpp = scaling,bins = binsequence, ensemble = True)
#This makes array for the van hove correlation function for a lagtime of half a second
In [18]:
def manualnorm(histdata):
return (1/(histdata.sum()*binwidth))*histdata
In [19]:
## Normalize all
vh1nrx = manualnorm(vh1nrx)
vh1nrx = manualnorm(vh1nrx)
vh1ngx = manualnorm(vh1ngx)
vh1nry = manualnorm(vh1nry)
vh1ngy = manualnorm(vh1ngy)
vh1hrx = manualnorm(vh1hrx)
vh1hgx = manualnorm(vh1hgx)
vh1hry = manualnorm(vh1hry)
vh1hgy = manualnorm(vh1hgy)
In [20]:
vh2nrx = manualnorm(tp.motion.vanhove(posnrx, lagtime = 12, mpp = scaling,bins = binsequence, ensemble = True))
vh2ngx = manualnorm(tp.motion.vanhove(posngx, lagtime = 12, mpp = scaling,bins = binsequence, ensemble = True))
vh2nry = manualnorm(tp.motion.vanhove(posnry, lagtime = 12, mpp = scaling,bins = binsequence, ensemble = True))
vh2ngy = manualnorm(tp.motion.vanhove(posngy, lagtime = 12, mpp = scaling,bins = binsequence, ensemble = True))
vh2hrx = manualnorm(tp.motion.vanhove(poshrx, lagtime = 12, mpp = scaling,bins = binsequence, ensemble = True))
vh2hgx = manualnorm(tp.motion.vanhove(poshgx, lagtime = 12, mpp = scaling,bins = binsequence, ensemble = True))
vh2hry = manualnorm(tp.motion.vanhove(poshry, lagtime = 12, mpp = scaling,bins = binsequence, ensemble = True))
vh2hgy = manualnorm(tp.motion.vanhove(poshgy, lagtime = 12, mpp = scaling,bins = binsequence, ensemble = True))
#This makes array for the van hove correlation function for a lagtime of 1 second
In [21]:
vh3nrx = manualnorm(tp.motion.vanhove(posnrx, lagtime = 24, mpp = scaling,bins = binsequence, ensemble = True))
vh3ngx = manualnorm(tp.motion.vanhove(posngx, lagtime = 24, mpp = scaling,bins = binsequence, ensemble = True))
vh3nry = manualnorm(tp.motion.vanhove(posnry, lagtime = 24, mpp = scaling,bins = binsequence, ensemble = True))
vh3ngy = manualnorm(tp.motion.vanhove(posngy, lagtime = 24, mpp = scaling,bins = binsequence, ensemble = True))
vh3hrx = manualnorm(tp.motion.vanhove(poshrx, lagtime = 24, mpp = scaling,bins = binsequence, ensemble = True))
vh3hgx = manualnorm(tp.motion.vanhove(poshgx, lagtime = 24, mpp = scaling,bins = binsequence, ensemble = True))
vh3hry = manualnorm(tp.motion.vanhove(poshry, lagtime = 24, mpp = scaling,bins = binsequence, ensemble = True))
vh3hgy = manualnorm(tp.motion.vanhove(poshgy, lagtime = 24, mpp = scaling,bins = binsequence, ensemble = True))
#This makes array for the van hove correlation function for a lagtime of 2 seconds
In [22]:
vh4nrx = manualnorm(tp.motion.vanhove(posnrx, lagtime = 48, mpp = scaling,bins = binsequence, ensemble = True))
vh4ngx = manualnorm(tp.motion.vanhove(posngx, lagtime = 48, mpp = scaling,bins = binsequence, ensemble = True))
vh4nry = manualnorm(tp.motion.vanhove(posnry, lagtime = 48, mpp = scaling,bins = binsequence, ensemble = True))
vh4ngy = manualnorm(tp.motion.vanhove(posngy, lagtime = 48, mpp = scaling,bins = binsequence, ensemble = True))
vh4hrx = manualnorm(tp.motion.vanhove(poshrx, lagtime = 48, mpp = scaling,bins = binsequence, ensemble = True))
vh4hgx = manualnorm(tp.motion.vanhove(poshgx, lagtime = 48, mpp = scaling,bins = binsequence, ensemble = True))
vh4hry = manualnorm(tp.motion.vanhove(poshry, lagtime = 48, mpp = scaling,bins = binsequence, ensemble = True))
vh4hgy = manualnorm(tp.motion.vanhove(poshgy, lagtime = 48, mpp = scaling,bins = binsequence, ensemble = True))
#This makes array for the van hove correlation function for a lagtime of 4 seconds
In [23]:
vh5nrx = manualnorm(tp.motion.vanhove(posnrx, lagtime = 96, mpp = scaling,bins = binsequence, ensemble = True))
vh5ngx = manualnorm(tp.motion.vanhove(posngx, lagtime = 96, mpp = scaling,bins = binsequence, ensemble = True))
vh5nry = manualnorm(tp.motion.vanhove(posnry, lagtime = 96, mpp = scaling,bins = binsequence, ensemble = True))
vh5ngy = manualnorm(tp.motion.vanhove(posngy, lagtime = 96, mpp = scaling,bins = binsequence, ensemble = True))
vh5hrx = manualnorm(tp.motion.vanhove(poshrx, lagtime = 96, mpp = scaling,bins = binsequence, ensemble = True))
vh5hgx = manualnorm(tp.motion.vanhove(poshgx, lagtime = 96, mpp = scaling,bins = binsequence, ensemble = True))
vh5hry = manualnorm(tp.motion.vanhove(poshry, lagtime = 96, mpp = scaling,bins = binsequence, ensemble = True))
vh5hgy = manualnorm(tp.motion.vanhove(poshgy, lagtime = 96, mpp = scaling,bins = binsequence, ensemble = True))
#This makes array for the van hove correlation function for a lagtime of 8 seconds
In [24]:
vh6nrx = manualnorm(tp.motion.vanhove(posnrx, lagtime = 192, mpp = scaling,bins = binsequence, ensemble = True))
vh6ngx = manualnorm(tp.motion.vanhove(posngx, lagtime = 192, mpp = scaling,bins = binsequence, ensemble = True))
vh6nry = manualnorm(tp.motion.vanhove(posnry, lagtime = 192, mpp = scaling,bins = binsequence, ensemble = True))
vh6ngy = manualnorm(tp.motion.vanhove(posngy, lagtime = 192, mpp = scaling,bins = binsequence, ensemble = True))
vh6hrx = manualnorm(tp.motion.vanhove(poshrx, lagtime = 192, mpp = scaling,bins = binsequence, ensemble = True))
vh6hgx = manualnorm(tp.motion.vanhove(poshgx, lagtime = 192, mpp = scaling,bins = binsequence, ensemble = True))
vh6hry = manualnorm(tp.motion.vanhove(poshry, lagtime = 192, mpp = scaling,bins = binsequence, ensemble = True))
vh6hgy = manualnorm(tp.motion.vanhove(poshgy, lagtime = 192, mpp = scaling,bins = binsequence, ensemble = True))
#This makes array for the van hove correlation function for a lagtime of 16 seconds
In [25]:
import math
def gaussian(x,a,b,c):
return a*(exp(-((x-b)**2)/(2*(c**2))))
def vanhove_and_fit(pos, lagtime, mpp=scaling, bins=100, ensemble=True, fit_function=gaussian): vh = tp.motion.vanhove(pos, lagtime, mpp ,bins, ensemble) params,covm = sco.curve_fit(fit_function,vh.index, vh.get_values()) yfit = fit_function(vh.index, params[0],params[1],params[2])
return (vh, params, covm, yfit)
vh1nrx_try, params1nrx_try, covm1nrx_try, yfit1nrx_try = vanhove_and_fit(posnrx, lagtime = 6)
In [26]:
paramsc1,covmc1 = sco.curve_fit(gaussian,vh1nrx.index,vh1nrx.get_values())
yfitc1 = gaussian(vh1nrx.index,paramsc1[0],paramsc1[1],paramsc1[2])
paramst1,covmt1 = sco.curve_fit(gaussian,vh1hrx.index,vh1hrx.get_values())
yfitt1 = gaussian(vh1hrx.index,paramst1[0],paramst1[1],paramst1[2])
paramsj1,covmj1 = sco.curve_fit(gaussian,vh1hgx.index,vh1hgx.get_values())
yfitj1 = gaussian(vh1hgx.index,paramsj1[0],paramsj1[1],paramsj1[2])
vh1nrx.plot(style = 'b.',label = 'control')
vh1hrx.plot(style = 'r.',label = 'tracer')
vh1hgx.plot(style = 'g.',label = 'janus')
plt.plot(vh1nrx.index,yfitc1,color='b')
plt.plot(vh1hrx.index,yfitt1,color='r')
plt.plot(vh1hgx.index,yfitj1,color='g')
plt.yscale('log')
plt.title('1/2 second')
plt.legend()
plt.ylabel('P($\Delta$ x)')
plt.xlabel('$\Delta$ x (micron)')
ylim(ymin=0.00003, ymax=1)
xlim(-4,4)
Out[26]:
In [27]:
paramsc2,covmc2 = sco.curve_fit(gaussian,vh2nrx.index,vh2nrx.get_values())
yfitc2 = gaussian(vh2nrx.index,paramsc2[0],paramsc2[1],paramsc2[2])
paramst2,covmt2 = sco.curve_fit(gaussian,vh2hrx.index,vh2hrx.get_values())
yfitt2 = gaussian(vh2hrx.index,paramst2[0],paramst2[1],paramst2[2])
paramsj2,covmj2 = sco.curve_fit(gaussian,vh2hgx.index,vh2hgx.get_values())
yfitj2 = gaussian(vh2hgx.index,paramsj2[0],paramsj2[1],paramsj2[2])
vh2nrx.plot(style = 'b.',label = 'control')
vh2hrx.plot(style = 'r.',label = 'tracer')
vh2hgx.plot(style = 'g.',label = 'janus')
plt.plot(vh2nrx.index,yfitc2,color='b')
plt.plot(vh2hrx.index,yfitt2,color='r')
plt.plot(vh2hgx.index,yfitj2,color='g')
plt.yscale('log')
plt.title('1 second')
plt.legend()
plt.ylabel('P($\Delta$ x)')
plt.xlabel('$\Delta$ x (micron)')
plt.xlim([-5,5])
ylim(ymin=3e-5, ymax=1)
Out[27]:
In [28]:
paramsc3,covmc3 = sco.curve_fit(gaussian,vh3nrx.index,vh3nrx.get_values())
yfitc3 = gaussian(vh3nrx.index,paramsc3[0],paramsc3[1],paramsc3[2])
paramst3,covmt3 = sco.curve_fit(gaussian,vh3hrx.index,vh3hrx.get_values())
yfitt3 = gaussian(vh3hrx.index,paramst3[0],paramst3[1],paramst3[2])
paramsj3,covmj3 = sco.curve_fit(gaussian,vh3hgx.index,vh3hgx.get_values())
yfitj3 = gaussian(vh3hgx.index,paramsj3[0],paramsj3[1],paramsj3[2])
vh3nrx.plot(style = 'b.',label = 'control')
vh3hrx.plot(style = 'r.',label = 'tracer')
vh3hgx.plot(style = 'g.',label = 'janus')
plt.plot(vh3nrx.index,yfitc3,color='b')
plt.plot(vh3hrx.index,yfitt3,color='r')
plt.plot(vh3hgx.index,yfitj3,color='g')
plt.yscale('log')
plt.title('2 seconds')
plt.legend()
plt.ylabel('P($\Delta$ x)')
plt.xlabel('$\Delta$ x (micron)')
plt.xlim([-5,5])
ylim(ymin=3e-5, ymax=1)
Out[28]:
In [29]:
paramsc4,covmc4 = sco.curve_fit(gaussian,vh4nrx.index,vh4nrx.get_values())
yfitc4 = gaussian(vh4nrx.index,paramsc4[0],paramsc4[1],paramsc4[2])
paramst4,covmt4 = sco.curve_fit(gaussian,vh4hrx.index,vh4hrx.get_values())
yfitt4 = gaussian(vh4hrx.index,paramst4[0],paramst4[1],paramst4[2])
paramsj4,covmj4 = sco.curve_fit(gaussian,vh4hgx.index,vh4hgx.get_values())
yfitj4 = gaussian(vh4hgx.index,paramsj4[0],paramsj4[1],paramsj4[2])
vh4nrx.plot(style = 'b.',label = 'control')
vh4hrx.plot(style = 'r.',label = 'tracer')
vh4hgx.plot(style = 'g.',label = 'janus')
plt.plot(vh4nrx.index,yfitc4,color='b')
plt.plot(vh4hrx.index,yfitt4,color='r')
plt.plot(vh4hgx.index,yfitj4,color='g')
plt.yscale('log')
plt.title('4 seconds')
plt.legend()
plt.ylabel('P($\Delta$ x)')
plt.xlabel('$\Delta$ x (micron)')
plt.xlim([-7,7])
ylim(ymin=3e-5, ymax=1)
Out[29]:
In [30]:
paramsc5,covmc5 = sco.curve_fit(gaussian,vh5nrx.index,vh5nrx.get_values())
yfitc5 = gaussian(vh5nrx.index,paramsc5[0],paramsc5[1],paramsc5[2])
paramst5,covmt5 = sco.curve_fit(gaussian,vh5hrx.index,vh5hrx.get_values())
yfitt5 = gaussian(vh5hrx.index,paramst5[0],paramst5[1],paramst5[2])
paramsj5,covmj5 = sco.curve_fit(gaussian,vh5hgx.index,vh5hgx.get_values())
yfitj5 = gaussian(vh5hgx.index,paramsj5[0],paramsj5[1],paramsj5[2])
vh5nrx.plot(style = 'b.',label = 'control')
vh5hrx.plot(style = 'r.',label = 'tracer')
vh5hgx.plot(style = 'g.',label = 'janus')
plt.plot(vh5nrx.index,yfitc5,color='b')
plt.plot(vh5hrx.index,yfitt5,color='r')
plt.plot(vh5hgx.index,yfitj5,color='g')
plt.yscale('log')
plt.title('8 seconds')
plt.legend()
plt.ylabel('P($\Delta$ x)')
plt.xlabel('$\Delta$ x (micron)')
plt.xlim([-10,10])
#ylim(ymin=3e-5, ymax=1)
xlim(-7.5,7.5)
Out[30]:
In [31]:
paramsc6,covmc6 = sco.curve_fit(gaussian,vh6nrx.index,vh6nrx.get_values())
yfitc6 = gaussian(vh6nrx.index,paramsc6[0],paramsc6[1],paramsc6[2])
paramst6,covmt6 = sco.curve_fit(gaussian,vh6hrx.index,vh6hrx.get_values())
yfitt6 = gaussian(vh6hrx.index,paramst6[0],paramst6[1],paramst6[2])
paramsj6,covmj6 = sco.curve_fit(gaussian,vh6hgx.index,vh6hgx.get_values())
yfitj6 = gaussian(vh5hgx.index,paramsj6[0],paramsj6[1],paramsj6[2])
vh6nrx.plot(style = 'b.',label = 'control')
vh6hrx.plot(style = 'r.',label = 'tracer')
vh6hgx.plot(style = 'g.',label = 'janus')
plt.plot(vh6nrx.index,yfitc6,color='b')
plt.plot(vh6hrx.index,yfitt6,color='r')
plt.plot(vh6hgx.index,yfitj6,color='g')
plt.yscale('log')
plt.title('16 seconds')
plt.legend()
plt.ylabel('P($\Delta$ x)')
plt.xlabel('$\Delta$ x (micron)')
Out[31]:
In [32]:
paramsc1,covmc1 = sco.curve_fit(gaussian,vh1nrx.index,vh1nrx.get_values())
yfitc1 = gaussian(vh1nrx.index,paramsc1[0],paramsc1[1],paramsc1[2])
paramst1,covmt1 = sco.curve_fit(gaussian,vh1hrx.index,vh1hrx.get_values())
yfitt1 = gaussian(vh1hrx.index,paramst1[0],paramst1[1],paramst1[2])
paramsj1,covmj1 = sco.curve_fit(gaussian,vh1hgx.index,vh1hgx.get_values())
yfitj1 = gaussian(vh1hgx.index,paramsj1[0],paramsj1[1],paramsj1[2])
vh1nrx.plot(style = 'b.',label = 'control')
vh1hrx.plot(style = 'r.',label = 'tracer')
vh1hgx.plot(style = 'g.',label = 'janus')
plt.plot(vh1nrx.index,yfitc1,color='blue')
plt.plot(vh1hrx.index,yfitt1,color='red')
plt.plot(vh1hgx.index,yfitj1,color='green')
plt.yscale('linear')
plt.title('1/2 second')
plt.legend()
plt.ylabel('P($\Delta$ x)')
plt.xlabel('$\Delta$ x (micron)')
xlim(-3,3)
Out[32]:
In [33]:
paramsc2,covmc2 = sco.curve_fit(gaussian,vh2nrx.index,vh2nrx.get_values())
yfitc2 = gaussian(vh2nrx.index,paramsc2[0],paramsc2[1],paramsc2[2])
paramst2,covmt2 = sco.curve_fit(gaussian,vh2hrx.index,vh2hrx.get_values())
yfitt2 = gaussian(vh2hrx.index,paramst2[0],paramst2[1],paramst2[2])
paramsj2,covmj2 = sco.curve_fit(gaussian,vh2hgx.index,vh2hgx.get_values())
yfitj2 = gaussian(vh2hgx.index,paramsj2[0],paramsj2[1],paramsj2[2])
vh2nrx.plot(style = 'b.',label = 'control')
vh2hrx.plot(style = 'r.',label = 'tracer')
vh2hgx.plot(style = 'g.',label = 'janus')
plt.plot(vh2nrx.index,yfitc2,color='blue')
plt.plot(vh2hrx.index,yfitt2,color='red')
plt.plot(vh2hgx.index,yfitj2,color='green')
plt.yscale('linear')
plt.title('1 second')
plt.legend()
plt.ylabel('P($\Delta$ x)')
plt.xlabel('$\Delta$ x (micron)')
xlim(-3,3)
Out[33]:
In [34]:
paramsc3,covmc3 = sco.curve_fit(gaussian,vh3nrx.index,vh3nrx.get_values())
yfitc3 = gaussian(vh3nrx.index,paramsc3[0],paramsc3[1],paramsc3[2])
paramst3,covmt3 = sco.curve_fit(gaussian,vh3hrx.index,vh3hrx.get_values())
yfitt3 = gaussian(vh3hrx.index,paramst3[0],paramst3[1],paramst3[2])
paramsj3,covmj3 = sco.curve_fit(gaussian,vh3hgx.index,vh3hgx.get_values())
yfitj3 = gaussian(vh3hgx.index,paramsj3[0],paramsj3[1],paramsj3[2])
vh3nrx.plot(style = 'b.',label = 'control')
vh3hrx.plot(style = 'r.',label = 'tracer')
vh3hgx.plot(style = 'g.',label = 'janus')
plt.plot(vh3nrx.index,yfitc3,color='blue')
plt.plot(vh3hrx.index,yfitt3,color='red')
plt.plot(vh3hgx.index,yfitj3,color='green')
plt.yscale('linear')
plt.title('2 seconds')
plt.legend()
plt.ylabel('P($\Delta$ x)')
plt.xlabel('$\Delta$ x (micron)')
Out[34]:
In [35]:
paramsc4,covmc4 = sco.curve_fit(gaussian,vh4nrx.index,vh4nrx.get_values())
yfitc4 = gaussian(vh4nrx.index,paramsc4[0],paramsc4[1],paramsc4[2])
paramst4,covmt4 = sco.curve_fit(gaussian,vh4hrx.index,vh4hrx.get_values())
yfitt4 = gaussian(vh4hrx.index,paramst4[0],paramst4[1],paramst4[2])
paramsj4,covmj4 = sco.curve_fit(gaussian,vh4hgx.index,vh4hgx.get_values())
yfitj4 = gaussian(vh4hgx.index,paramsj4[0],paramsj4[1],paramsj4[2])
vh4nrx.plot(style = 'b.',label = 'control')
vh4hrx.plot(style = 'r.',label = 'tracer')
vh4hgx.plot(style = 'g.',label = 'janus')
plt.plot(vh4nrx.index,yfitc4,color='blue')
plt.plot(vh4hrx.index,yfitt4,color='red')
plt.plot(vh4hgx.index,yfitj4,color='green')
plt.yscale('linear')
plt.title('4 seconds')
plt.legend()
plt.ylabel('P($\Delta$ x)')
plt.xlabel('$\Delta$ x (micron)')
Out[35]:
In [36]:
paramsc5,covmc5 = sco.curve_fit(gaussian,vh5nrx.index,vh5nrx.get_values())
yfitc5 = gaussian(vh5nrx.index,paramsc5[0],paramsc5[1],paramsc5[2])
paramst5,covmt5 = sco.curve_fit(gaussian,vh5hrx.index,vh5hrx.get_values())
yfitt5 = gaussian(vh5hrx.index,paramst5[0],paramst5[1],paramst5[2])
paramsj5,covmj5 = sco.curve_fit(gaussian,vh5hgx.index,vh5hgx.get_values())
yfitj5 = gaussian(vh5hgx.index,paramsj5[0],paramsj5[1],paramsj5[2])
vh5nrx.plot(style = 'b.',label = 'control')
vh5hrx.plot(style = 'r.',label = 'tracer')
vh5hgx.plot(style = 'g.',label = 'janus')
plt.plot(vh5nrx.index,yfitc5,color='blue')
plt.plot(vh5hrx.index,yfitt5,color='red')
plt.plot(vh5hgx.index,yfitj5,color='green')
plt.yscale('linear')
plt.title('8 seconds')
plt.legend()
plt.ylabel('P($\Delta$ x)')
plt.xlabel('$\Delta$ x (micron)')
Out[36]:
In [37]:
paramsc6,covmc6 = sco.curve_fit(gaussian,vh6nrx.index,vh6nrx.get_values())
yfitc6 = gaussian(vh6nrx.index,paramsc6[0],paramsc6[1],paramsc6[2])
paramst6,covmt6 = sco.curve_fit(gaussian,vh6hrx.index,vh6hrx.get_values())
yfitt6 = gaussian(vh6hrx.index,paramst6[0],paramst6[1],paramst6[2])
paramsj6,covmj6 = sco.curve_fit(gaussian,vh6hgx.index,vh6hgx.get_values())
yfitj6 = gaussian(vh5hgx.index,paramsj6[0],paramsj6[1],paramsj6[2])
vh6nrx.plot(style = 'b.',label = 'control')
vh6hrx.plot(style = 'r.',label = 'tracer')
vh6hgx.plot(style = 'g.',label = 'janus')
plt.plot(vh6nrx.index,yfitc6,color='blue')
plt.plot(vh6hrx.index,yfitt6,color='red')
plt.plot(vh6hgx.index,yfitj6,color='green')
plt.yscale('linear')
plt.title('16 seconds')
plt.legend()
plt.ylabel('P($\Delta$ x)')
plt.xlabel('$\Delta$ x (micron)')
Out[37]:
In [38]:
paramsst,covmst = sco.curve_fit(gaussian,vh3nrx.index,vh3nrx.get_values())
yfitst = gaussian(vh3nrx.index,paramsst[0],paramsst[1],paramsst[2])
paramssj,covmsj = sco.curve_fit(gaussian,vh3ngx.index,vh3ngx.get_values())
yfitsj = gaussian(vh3ngx.index,paramssj[0],paramssj[1],paramssj[2])
vh3nrx.plot(style = 'r.',label = 'tracer')
vh3ngx.plot(style = 'g.',label = 'janus')
plt.plot(vh3nrx.index,yfitst,color = 'red')
plt.plot(vh3ngx.index,yfitsj, color = 'green')
plt.yscale('log')
plt.legend()
plt.title('8 seconds no H2O2')
ylim(ymin=3e-5, ymax=1)
Out[38]:
If there is some difference here it could possibly because of the dimers and trimers formed during the process of making the janus particles.
In [56]:
vh3hrxi = tp.motion.vanhove(poshrx, lagtime = 24, mpp = scaling,bins = binsequence, ensemble = False)
#vh3hrxi.sum()
Out[56]:
In [40]:
vh3hrxi.plot(style = 'r.',label = 'tracer')
Out[40]:
In [41]:
paramsst,covmst = sco.curve_fit(gaussian,vh3nrx.index,vh3nrx.get_values())
yfitst = gaussian(vh3nrx.index,paramsst[0],paramsst[1],paramsst[2])
paramssj,covmsj = sco.curve_fit(gaussian,vh3ngx.index,vh3ngx.get_values())
yfitsj = gaussian(vh3ngx.index,paramssj[0],paramssj[1],paramssj[2])
vh3nrx.plot(style = 'r.',label = 'tracer')
vh3ngx.plot(style = 'g.',label = 'janus')
plt.plot(vh3nrx.index,yfitst,color = 'red')
plt.plot(vh3ngx.index,yfitsj, color = 'green')
plt.yscale('linear')
plt.legend()
plt.title('8 seconds no H2O2')
Out[41]:
In [42]:
vh3nrx.plot(style = 'b.',label = 'control')
vh3hrx.plot(style = 'r.',label = 'tracer')
vh3hgx.plot(style = 'g.',label = 'janus')
Out[42]:
In [43]:
vh3hrx.plot(style = 'r.',label = 'tracer')
Out[43]:
In [44]:
vh3hgx.plot(style = 'g.',label = 'janus')
Out[44]:
In [45]:
import seaborn as sns
sns.set(style='ticks')
sns.set_context('paper')
#sns.set_palette(sns.husl_palette(10,l=.55))
# 10pt font
font = {'size' : 10}
plt.rc('font', **font)
plt.rcParams.update({'legend.handlelength': 0})
plt.rcParams.update({'axes.titlesize' : 10 })
plt.rcParams.update({'axes.linewidth' : .2,
'xtick.major.size': 2 ,'ytick.major.size': 2,
'xtick.minor.size': 10 ,'ytick.minor.size': 10,
'axes.labelpad': 0})
plt.rcParams.update({'xtick.labelsize':10, 'ytick.labelsize':10})
myms = 2
mylw = .5
myymin = 4e-5
plt.subplot(2,4,1)
vh1nrx.plot(style = 'b.',label = 'control', ms=myms)
vh1hrx.plot(style = 'r.',label = 'tracer', ms=myms)
vh1hgx.plot(style = 'g.',label = 'janus', ms=myms)
axB = plt.gca()
plt.plot(vh1nrx.index,yfitc1,color='blue', linewidth=mylw)
plt.plot(vh1hrx.index,yfitt1,color='red', linewidth=mylw)
plt.plot(vh1hgx.index,yfitj1,color='green', linewidth=mylw)
plt.yscale('linear')
plt.title('B', loc='left')
plt.legend(bbox_to_anchor=(0., 1.5, 1., .102), loc=3,
ncol=2, mode="expand", borderaxespad=0.)
plt.ylabel('$P(\Delta{}x)$')
plt.xlabel('$\Delta{}x$ ($\mathrm{\mu}$m)')
xlim(-3,3)
tick_params(which='both', pad=3)
tick_params( which='both', pad=2)
#ylim(ymin=0)
plt.xticks([-3,0, 3])
plt.subplot(2,4,2)
vh2nrx.plot(style = 'b.',label = 'control', ms=myms)
vh2hrx.plot(style = 'r.',label = 'tracer', ms=myms)
vh2hgx.plot(style = 'g.',label = 'janus', ms=myms)
plt.plot(vh2nrx.index,yfitc2,color='blue', linewidth=mylw)
plt.plot(vh2hrx.index,yfitt2,color='red', linewidth=mylw)
plt.plot(vh2hgx.index,yfitj2,color='green', linewidth=mylw)
plt.yscale('linear')
plt.title('C', loc='left')
axC = plt.gca()
#plt.legend()
#plt.ylabel('$P(\Delta{}x)$')
plt.xlabel('$\Delta{}x$ ($\mathrm{\mu}$m)')
xlim(-5,5)
tick_params(which='both', pad=3)
tick_params( which='both', pad=2)
#ylim(ymin=0)
plt.subplot(2,4,3)
vh3nrx.plot(style = 'b.',label = 'control', ms=myms)
vh3hrx.plot(style = 'r.',label = 'tracer', ms=myms)
vh3hgx.plot(style = 'g.',label = 'janus', ms=myms)
plt.plot(vh3nrx.index,yfitc3,color='blue', linewidth=mylw)
plt.plot(vh3hrx.index,yfitt3,color='red', linewidth=mylw)
plt.plot(vh3hgx.index,yfitj3,color='green', linewidth=mylw)
plt.yscale('linear')
#plt.title('2 seconds')
plt.title('D', loc='left')
axD = plt.gca()
#plt.legend()
#plt.ylabel('$P(\Delta{}x)$')
plt.xlabel('$\Delta{}x$ ($\mathrm{\mu}$m)')
tick_params(which='both', pad=3)
tick_params( which='both', pad=2)
#ylim(ymin=0)
plt.subplot(2,4,4)
vh4nrx.plot(style = 'b.',label = 'control', ms=myms)
vh4hrx.plot(style = 'r.',label = 'tracer', ms=myms)
vh4hgx.plot(style = 'g.',label = 'janus', ms=myms)
plt.plot(vh4nrx.index,yfitc4,color='blue', linewidth=mylw)
plt.plot(vh4hrx.index,yfitt4,color='red', linewidth=mylw)
plt.plot(vh4hgx.index,yfitj4,color='green', linewidth=mylw)
plt.yscale('linear')
#plt.title('4 seconds')
plt.title('E', loc='left')
axE = plt.gca()
#plt.legend()
#plt.ylabel('$P(\Delta{}x)$')
plt.xlabel('$\Delta{}x$ ($\mathrm{\mu}$m)')
tick_params(which='both', pad=3)
tick_params( which='both', pad=2)
#ylim(ymin=0)
plt.subplot(2,4,5)
vh1nrx.plot(style = 'b.',label = 'control', ms=myms)
vh1hrx.plot(style = 'r.',label = 'tracer', ms=myms)
vh1hgx.plot(style = 'g.',label = 'janus', ms=myms)
plt.plot(vh1nrx.index,yfitc1,color='blue', linewidth=mylw)
plt.plot(vh1hrx.index,yfitt1,color='red', linewidth=mylw)
plt.plot(vh1hgx.index,yfitj1,color='green', linewidth=mylw)
plt.yscale('log')
plt.title('F', loc='left')
axF = plt.gca()
#plt.legend(bbox_to_anchor=(0., 1.5, 1., .102), loc=3,
# ncol=2, mode="expand", borderaxespad=0.)
plt.ylabel('$P(\Delta{}x)$')
plt.xlabel('$\Delta{}x$ ($\mathrm{\mu}$m)')
xlim(-3,3)
ylim(ymin=myymin,ymax=1)
tick_params(which='both', pad=3)
tick_params( which='both', pad=2)
plt.yticks([1e-4,1e-3, 1e-2, 1e-1])
plt.xticks([-3,0, 3])
plt.subplot(2,4,6)
vh2nrx.plot(style = 'b.',label = 'control', ms=myms)
vh2hrx.plot(style = 'r.',label = 'tracer', ms=myms)
vh2hgx.plot(style = 'g.',label = 'janus', ms=myms)
plt.plot(vh2nrx.index,yfitc2,color='blue', linewidth=mylw)
plt.plot(vh2hrx.index,yfitt2,color='red', linewidth=mylw)
plt.plot(vh2hgx.index,yfitj2,color='green', linewidth=mylw)
plt.yscale('log')
plt.title('G', loc='left')
axG = plt.gca()
#plt.legend()
#plt.ylabel('$P(\Delta{}x)$')
plt.xlabel('$\Delta{}x$ ($\mathrm{\mu}$m)')
xlim(-5,5)
ylim(ymin=myymin,ymax=1)
tick_params(which='both', pad=3)
tick_params( which='both', pad=2)
plt.yticks([1e-4,1e-3, 1e-2, 1e-1])
plt.subplot(2,4,7)
vh3nrx.plot(style = 'b.',label = 'control', ms=myms)
vh3hrx.plot(style = 'r.',label = 'tracer', ms=myms)
vh3hgx.plot(style = 'g.',label = 'janus', ms=myms)
plt.plot(vh3nrx.index,yfitc3,color='blue', linewidth=mylw)
plt.plot(vh3hrx.index,yfitt3,color='red', linewidth=mylw)
plt.plot(vh3hgx.index,yfitj3,color='green', linewidth=mylw)
plt.yscale('log')
ylim(ymin=myymin,ymax=1)
#plt.title('2 seconds')
plt.title('H', loc='left')
axH = plt.gca()
#plt.legend()
#plt.ylabel('$P(\Delta{}x)$')
plt.xlabel('$\Delta{}x$ ($\mathrm{\mu}$m)')
tick_params(which='both', pad=3)
tick_params( which='both', pad=2)
plt.yticks([1e-4,1e-3, 1e-2, 1e-1])
plt.subplot(2,4,8)
vh4nrx.plot(style = 'b.',label = 'control', ms=myms)
vh4hrx.plot(style = 'r.',label = 'tracer', ms=myms)
vh4hgx.plot(style = 'g.',label = 'janus', ms=myms)
plt.plot(vh4nrx.index,yfitc4,color='blue', linewidth=mylw)
plt.plot(vh4hrx.index,yfitt4,color='red', linewidth=mylw)
plt.plot(vh4hgx.index,yfitj4,color='green', linewidth=mylw)
plt.yscale('log')
ylim(ymin=myymin,ymax=1)
#plt.title('4 seconds')
plt.title('I', loc='left')
axI = plt.gca()
xlim(-10,10)
#plt.legend()
#plt.ylabel('$P(\Delta{}x)$')
plt.xlabel('$\Delta{}x$ ($\mathrm{\mu}$m)')
tick_params(which='both', pad=3)
tick_params( which='both', pad=2)
plt.yticks([1e-4,1e-3, 1e-2, 1e-1])
fig = plt.gcf()
thisheight=2.7
thiswidth=5
fig.set_figheight(thisheight)
fig.set_figwidth(thiswidth)
plt.rcParams.update({'axes.titlesize' : 10 })
axB.set_title('$\Delta{}t = 0.5$ s', loc='right')
axC.set_title('$\Delta{}t = 1$ s', loc='right')
axD.set_title('$\Delta{}t = 2$ s', loc='right')
axE.set_title('$\Delta{}t = 4$ s', loc='right')
axF.set_title('$\Delta{}t = 0.5$ s', loc='right')
axG.set_title('$\Delta{}t = 1$ s', loc='right')
axH.set_title('$\Delta{}t = 2$ s', loc='right')
axI.set_title('$\Delta{}t = 4$ s', loc='right')
#axB.tick_params(which='minor', left=True, axis='y')
#axF.tick_params(which='minor', left=True, axis='y')
axG.tick_params(which='minor', left=True, axis='y')
sns.despine(offset=3, trim=False);
plt.tight_layout()
os.chdir('C:\\Users\\Viva\\Desktop\\EPJ folder\\paperfigures')
try:
plt.savefig('vanhove,' + moviename + '.pdf',
bbox_inches='tight', figsize=(thiswidth, thisheight))
plt.savefig('vanhove,' + moviename + '.svg',
bbox_inches='tight', figsize=(thiswidth, thisheight))
print('pdf saved')
plt.savefig('vanhove,' + moviename + '.png',
bbox_inches='tight', dpi=600, figsize=(thiswidth, thisheight))
except IOError:
print('Close the pdf file so I can overwrite it.')
In [46]:
import seaborn as sns
sns.set(style='ticks')
sns.set_context('paper')
#sns.set_palette(sns.husl_palette(10,l=.55))
# 10pt font
font = {'size' : 10}
plt.rc('font', **font)
plt.rcParams.update({'legend.handlelength': 0})
plt.rcParams.update({'axes.titlesize' : 10 })
plt.rcParams.update({'axes.linewidth' : .2,
'xtick.major.size': 2 ,'ytick.major.size': 2,
'xtick.minor.size': 1.5 ,'ytick.minor.size': 1.5,
'xtick.labelsize':10, 'ytick.labelsize':10,
'axes.labelpad': 0})
myms = 2
mylw = .5
myymin = 4e-5
plt.subplot(2,4,1)
vh1nrx.plot(style = 'b.',label = 'control', ms=myms)
vh1hrx.plot(style = 'r.',label = 'tracer', ms=myms)
#vh1hgx.plot(style = 'g.',label = 'janus', ms=myms)
axB = plt.gca()
plt.plot(vh1nrx.index,yfitc1,color='blue', linewidth=mylw)
plt.plot(vh1hrx.index,yfitt1,color='red', linewidth=mylw)
#plt.plot(vh1hgx.index,yfitj1,color='green', linewidth=mylw)
plt.yscale('linear')
plt.title('B', loc='left')
plt.legend(bbox_to_anchor=(0., 1.5, 1., .102), loc=3,
ncol=2, mode="expand", borderaxespad=0.)
plt.ylabel('$P(\Delta{}x)$')
plt.xlabel('$\Delta{}x$ ($\mathrm{\mu}$m)')
xlim(-3,3)
tick_params(which='both', pad=3)
tick_params( which='both', pad=2)
#ylim(ymin=0)
plt.xticks([-3,0, 3])
plt.subplot(2,4,2)
vh2nrx.plot(style = 'b.',label = 'control', ms=myms)
vh2hrx.plot(style = 'r.',label = 'tracer', ms=myms)
#vh2hgx.plot(style = 'g.',label = 'janus', ms=myms)
plt.plot(vh2nrx.index,yfitc2,color='blue', linewidth=mylw)
plt.plot(vh2hrx.index,yfitt2,color='red', linewidth=mylw)
#plt.plot(vh2hgx.index,yfitj2,color='green', linewidth=mylw)
plt.yscale('linear')
plt.title('C', loc='left')
axC = plt.gca()
#plt.legend()
#plt.ylabel('$P(\Delta{}x)$')
plt.xlabel('$\Delta{}x$ ($\mathrm{\mu}$m)')
xlim(-5,5)
tick_params(which='both', pad=3)
tick_params( which='both', pad=2)
#ylim(ymin=0)
plt.subplot(2,4,3)
vh3nrx.plot(style = 'b.',label = 'control', ms=myms)
vh3hrx.plot(style = 'r.',label = 'tracer', ms=myms)
#vh3hgx.plot(style = 'g.',label = 'janus', ms=myms)
plt.plot(vh3nrx.index,yfitc3,color='blue', linewidth=mylw)
plt.plot(vh3hrx.index,yfitt3,color='red', linewidth=mylw)
#plt.plot(vh3hgx.index,yfitj3,color='green', linewidth=mylw)
plt.yscale('linear')
#plt.title('2 seconds')
plt.title('D', loc='left')
axD = plt.gca()
#plt.legend()
#plt.ylabel('$P(\Delta{}x)$')
plt.xlabel('$\Delta{}x$ ($\mathrm{\mu}$m)')
tick_params(which='both', pad=3)
tick_params( which='both', pad=2)
#ylim(ymin=0)
plt.subplot(2,4,4)
vh4nrx.plot(style = 'b.',label = 'control', ms=myms)
vh4hrx.plot(style = 'r.',label = 'tracer', ms=myms)
#vh4hgx.plot(style = 'g.',label = 'janus', ms=myms)
plt.plot(vh4nrx.index,yfitc4,color='blue', linewidth=mylw)
plt.plot(vh4hrx.index,yfitt4,color='red', linewidth=mylw)
#plt.plot(vh4hgx.index,yfitj4,color='green', linewidth=mylw)
plt.yscale('linear')
#plt.title('4 seconds')
plt.title('E', loc='left')
axE = plt.gca()
#plt.legend()
#plt.ylabel('$P(\Delta{}x)$')
plt.xlabel('$\Delta{}x$ ($\mathrm{\mu}$m)')
tick_params(which='both', pad=3)
tick_params( which='both', pad=2)
#ylim(ymin=0)
plt.subplot(2,4,5)
vh1nrx.plot(style = 'b.',label = 'control', ms=myms)
vh1hrx.plot(style = 'r.',label = 'tracer', ms=myms)
#vh1hgx.plot(style = 'g.',label = 'janus', ms=myms)
plt.plot(vh1nrx.index,yfitc1,color='blue', linewidth=mylw)
plt.plot(vh1hrx.index,yfitt1,color='red', linewidth=mylw)
#plt.plot(vh1hgx.index,yfitj1,color='green', linewidth=mylw)
plt.yscale('log')
plt.title('F', loc='left')
axF = plt.gca()
#plt.legend(bbox_to_anchor=(0., 1.5, 1., .102), loc=3,
# ncol=2, mode="expand", borderaxespad=0.)
plt.ylabel('$P(\Delta{}x)$')
plt.xlabel('$\Delta{}x$ ($\mathrm{\mu}$m)')
xlim(-3,3)
ylim(ymin=myymin,ymax=1)
tick_params(which='both', pad=3)
tick_params( which='both', pad=2)
plt.yticks([1e-4,1e-3, 1e-2, 1e-1])
plt.xticks([-3,0, 3])
plt.subplot(2,4,6)
vh2nrx.plot(style = 'b.',label = 'control', ms=myms)
vh2hrx.plot(style = 'r.',label = 'tracer', ms=myms)
#vh2hgx.plot(style = 'g.',label = 'janus', ms=myms)
plt.plot(vh2nrx.index,yfitc2,color='blue', linewidth=mylw)
plt.plot(vh2hrx.index,yfitt2,color='red', linewidth=mylw)
#plt.plot(vh2hgx.index,yfitj2,color='green', linewidth=mylw)
plt.yscale('log')
plt.title('G', loc='left')
axG = plt.gca()
#plt.legend()
#plt.ylabel('$P(\Delta{}x)$')
plt.xlabel('$\Delta{}x$ ($\mathrm{\mu}$m)')
xlim(-5,5)
ylim(ymin=myymin,ymax=1)
tick_params(which='both', pad=3)
tick_params( which='both', pad=2)
plt.yticks([1e-4,1e-3, 1e-2, 1e-1])
plt.subplot(2,4,7)
vh3nrx.plot(style = 'b.',label = 'control', ms=myms)
vh3hrx.plot(style = 'r.',label = 'tracer', ms=myms)
#vh3hgx.plot(style = 'g.',label = 'janus', ms=myms)
plt.plot(vh3nrx.index,yfitc3,color='blue', linewidth=mylw)
plt.plot(vh3hrx.index,yfitt3,color='red', linewidth=mylw)
#plt.plot(vh3hgx.index,yfitj3,color='green', linewidth=mylw)
plt.yscale('log')
ylim(ymin=myymin,ymax=1)
#plt.title('2 seconds')
plt.title('H', loc='left')
axH = plt.gca()
#plt.legend()
#plt.ylabel('$P(\Delta{}x)$')
plt.xlabel('$\Delta{}x$ ($\mathrm{\mu}$m)')
tick_params(which='both', pad=3)
tick_params( which='both', pad=2)
plt.yticks([1e-4,1e-3, 1e-2, 1e-1])
plt.subplot(2,4,8)
vh4nrx.plot(style = 'b.',label = 'control', ms=myms)
vh4hrx.plot(style = 'r.',label = 'tracer', ms=myms)
#vh4hgx.plot(style = 'g.',label = 'janus', ms=myms)
plt.plot(vh4nrx.index,yfitc4,color='blue', linewidth=mylw)
plt.plot(vh4hrx.index,yfitt4,color='red', linewidth=mylw)
#plt.plot(vh4hgx.index,yfitj4,color='green', linewidth=mylw)
plt.yscale('log')
ylim(ymin=myymin,ymax=1)
#plt.title('4 seconds')
plt.title('I', loc='left')
axI = plt.gca()
xlim(-10,10)
#plt.legend()
#plt.ylabel('$P(\Delta{}x)$')
plt.xlabel('$\Delta{}x$ ($\mathrm{\mu}$m)')
tick_params(which='both', pad=3)
tick_params( which='both', pad=2)
plt.yticks([1e-4,1e-3, 1e-2, 1e-1])
fig = plt.gcf()
thisheight=2.7
thiswidth=5
fig.set_figheight(thisheight)
fig.set_figwidth(thiswidth)
plt.rcParams.update({'axes.titlesize' : 10 })
axB.set_title('$\Delta{}t = 0.5$ s', loc='right')
axC.set_title('$\Delta{}t = 1$ s', loc='right')
axD.set_title('$\Delta{}t = 2$ s', loc='right')
axE.set_title('$\Delta{}t = 4$ s', loc='right')
axF.set_title('$\Delta{}t = 0.5$ s', loc='right')
axG.set_title('$\Delta{}t = 1$ s', loc='right')
axH.set_title('$\Delta{}t = 2$ s', loc='right')
axI.set_title('$\Delta{}t = 4$ s', loc='right')
#axB.tick_params(which='minor', left=True, axis='y')
#axF.tick_params(which='minor', left=True, axis='y')
axG.tick_params(which='minor', left=True, axis='y')
sns.despine(offset=3, trim=False);
plt.tight_layout()
os.chdir('C:\\Users\\Viva\\Desktop\\EPJ folder\\paperfigures')
try:
plt.savefig('vanhove,tracer,' + moviename + '.pdf',
bbox_inches='tight', figsize=(thiswidth, thisheight))
plt.savefig('vanhove,tracer,' + moviename + '.svg',
bbox_inches='tight', figsize=(thiswidth, thisheight))
print('pdf saved')
plt.savefig('vanhove,tracer,' + moviename + '.png',
bbox_inches='tight', dpi=600, figsize=(thiswidth, thisheight))
except IOError:
print('Close the pdf file so I can overwrite it.')
In [47]:
import seaborn as sns
sns.set(style='ticks')
sns.set_context('paper')
#sns.set_palette(sns.husl_palette(10,l=.55))
# 10pt font
font = {'size' : 10}
plt.rc('font', **font)
plt.rcParams.update({'legend.handlelength': 0})
plt.rcParams.update({'axes.titlesize' : 10 })
plt.rcParams.update({'axes.linewidth' : .2,
'xtick.major.size': 2 ,'ytick.major.size': 2,
'xtick.minor.size': 1.5 ,'ytick.minor.size': 1.5,
'xtick.labelsize':10, 'ytick.labelsize':10,
'axes.labelpad': 0})
myms = 2
mylw = .5
myymin = 4e-5
plt.subplot(2,4,1)
vh1nrx.plot(style = 'b.',label = 'control', ms=myms)
#vh1hrx.plot(style = 'r.',label = 'tracer', ms=myms)
vh1hgx.plot(style = 'g.',label = 'janus', ms=myms)
axB = plt.gca()
plt.plot(vh1nrx.index,yfitc1,color='blue', linewidth=mylw)
#plt.plot(vh1hrx.index,yfitt1,color='red', linewidth=mylw)
plt.plot(vh1hgx.index,yfitj1,color='green', linewidth=mylw)
plt.yscale('linear')
plt.title('B', loc='left')
plt.legend(bbox_to_anchor=(0., 1.5, 1., .102), loc=3,
ncol=2, mode="expand", borderaxespad=0.)
plt.ylabel('$P(\Delta{}x)$')
plt.xlabel('$\Delta{}x$ ($\mathrm{\mu}$m)')
xlim(-3,3)
tick_params(which='both', pad=3)
tick_params( which='both', pad=2)
#ylim(ymin=0)
plt.xticks([-3,0, 3])
plt.subplot(2,4,2)
vh2nrx.plot(style = 'b.',label = 'control', ms=myms)
#vh2hrx.plot(style = 'r.',label = 'tracer', ms=myms)
vh2hgx.plot(style = 'g.',label = 'janus', ms=myms)
plt.plot(vh2nrx.index,yfitc2,color='blue', linewidth=mylw)
#plt.plot(vh2hrx.index,yfitt2,color='red', linewidth=mylw)
plt.plot(vh2hgx.index,yfitj2,color='green', linewidth=mylw)
plt.yscale('linear')
plt.title('C', loc='left')
axC = plt.gca()
#plt.legend()
#plt.ylabel('$P(\Delta{}x)$')
plt.xlabel('$\Delta{}x$ ($\mathrm{\mu}$m)')
xlim(-5,5)
tick_params(which='both', pad=3)
tick_params( which='both', pad=2)
#ylim(ymin=0)
plt.subplot(2,4,3)
vh3nrx.plot(style = 'b.',label = 'control', ms=myms)
#vh3hrx.plot(style = 'r.',label = 'tracer', ms=myms)
vh3hgx.plot(style = 'g.',label = 'janus', ms=myms)
plt.plot(vh3nrx.index,yfitc3,color='blue', linewidth=mylw)
#plt.plot(vh3hrx.index,yfitt3,color='red', linewidth=mylw)
plt.plot(vh3hgx.index,yfitj3,color='green', linewidth=mylw)
plt.yscale('linear')
#plt.title('2 seconds')
plt.title('D', loc='left')
axD = plt.gca()
#plt.legend()
#plt.ylabel('$P(\Delta{}x)$')
plt.xlabel('$\Delta{}x$ ($\mathrm{\mu}$m)')
tick_params(which='both', pad=3)
tick_params( which='both', pad=2)
#ylim(ymin=0)
plt.subplot(2,4,4)
vh4nrx.plot(style = 'b.',label = 'control', ms=myms)
#vh4hrx.plot(style = 'r.',label = 'tracer', ms=myms)
vh4hgx.plot(style = 'g.',label = 'janus', ms=myms)
plt.plot(vh4nrx.index,yfitc4,color='blue', linewidth=mylw)
#plt.plot(vh4hrx.index,yfitt4,color='red', linewidth=mylw)
plt.plot(vh4hgx.index,yfitj4,color='green', linewidth=mylw)
plt.yscale('linear')
#plt.title('4 seconds')
plt.title('E', loc='left')
axE = plt.gca()
#plt.legend()
#plt.ylabel('$P(\Delta{}x)$')
plt.xlabel('$\Delta{}x$ ($\mathrm{\mu}$m)')
tick_params(which='both', pad=3)
tick_params( which='both', pad=2)
#ylim(ymin=0)
plt.subplot(2,4,5)
vh1nrx.plot(style = 'b.',label = 'control', ms=myms)
#vh1hrx.plot(style = 'r.',label = 'tracer', ms=myms)
vh1hgx.plot(style = 'g.',label = 'janus', ms=myms)
plt.plot(vh1nrx.index,yfitc1,color='blue', linewidth=mylw)
#plt.plot(vh1hrx.index,yfitt1,color='red', linewidth=mylw)
plt.plot(vh1hgx.index,yfitj1,color='green', linewidth=mylw)
plt.yscale('log')
plt.title('F', loc='left')
axF = plt.gca()
#plt.legend(bbox_to_anchor=(0., 1.5, 1., .102), loc=3,
# ncol=2, mode="expand", borderaxespad=0.)
plt.ylabel('$P(\Delta{}x)$')
plt.xlabel('$\Delta{}x$ ($\mathrm{\mu}$m)')
xlim(-3,3)
ylim(ymin=myymin,ymax=1)
tick_params(which='both', pad=3)
tick_params( which='both', pad=2)
plt.yticks([1e-4,1e-3, 1e-2, 1e-1])
plt.xticks([-3,0, 3])
plt.subplot(2,4,6)
vh2nrx.plot(style = 'b.',label = 'control', ms=myms)
#vh2hrx.plot(style = 'r.',label = 'tracer', ms=myms)
vh2hgx.plot(style = 'g.',label = 'janus', ms=myms)
plt.plot(vh2nrx.index,yfitc2,color='blue', linewidth=mylw)
#plt.plot(vh2hrx.index,yfitt2,color='red', linewidth=mylw)
plt.plot(vh2hgx.index,yfitj2,color='green', linewidth=mylw)
plt.yscale('log')
plt.title('G', loc='left')
axG = plt.gca()
#plt.legend()
#plt.ylabel('$P(\Delta{}x)$')
plt.xlabel('$\Delta{}x$ ($\mathrm{\mu}$m)')
xlim(-5,5)
ylim(ymin=myymin,ymax=1)
tick_params(which='both', pad=3)
tick_params( which='both', pad=2)
plt.yticks([1e-4,1e-3, 1e-2, 1e-1])
plt.subplot(2,4,7)
vh3nrx.plot(style = 'b.',label = 'control', ms=myms)
#vh3hrx.plot(style = 'r.',label = 'tracer', ms=myms)
vh3hgx.plot(style = 'g.',label = 'janus', ms=myms)
plt.plot(vh3nrx.index,yfitc3,color='blue', linewidth=mylw)
#plt.plot(vh3hrx.index,yfitt3,color='red', linewidth=mylw)
plt.plot(vh3hgx.index,yfitj3,color='green', linewidth=mylw)
plt.yscale('log')
ylim(ymin=myymin,ymax=1)
#plt.title('2 seconds')
plt.title('H', loc='left')
axH = plt.gca()
#plt.legend()
#plt.ylabel('$P(\Delta{}x)$')
plt.xlabel('$\Delta{}x$ ($\mathrm{\mu}$m)')
tick_params(which='both', pad=3)
tick_params( which='both', pad=2)
plt.yticks([1e-4,1e-3, 1e-2, 1e-1])
plt.subplot(2,4,8)
vh4nrx.plot(style = 'b.',label = 'control', ms=myms)
#vh4hrx.plot(style = 'r.',label = 'tracer', ms=myms)
vh4hgx.plot(style = 'g.',label = 'janus', ms=myms)
plt.plot(vh4nrx.index,yfitc4,color='blue', linewidth=mylw)
#plt.plot(vh4hrx.index,yfitt4,color='red', linewidth=mylw)
plt.plot(vh4hgx.index,yfitj4,color='green', linewidth=mylw)
plt.yscale('log')
ylim(ymin=myymin,ymax=1)
#plt.title('4 seconds')
plt.title('I', loc='left')
axI = plt.gca()
xlim(-10,10)
#plt.legend()
#plt.ylabel('$P(\Delta{}x)$')
plt.xlabel('$\Delta{}x$ ($\mathrm{\mu}$m)')
tick_params(which='both', pad=3)
tick_params( which='both', pad=2)
plt.yticks([1e-4,1e-3, 1e-2, 1e-1])
fig = plt.gcf()
thisheight=2.7
thiswidth=5
fig.set_figheight(thisheight)
fig.set_figwidth(thiswidth)
plt.rcParams.update({'axes.titlesize' : 10 })
axB.set_title('$\Delta{}t = 0.5$ s', loc='right')
axC.set_title('$\Delta{}t = 1$ s', loc='right')
axD.set_title('$\Delta{}t = 2$ s', loc='right')
axE.set_title('$\Delta{}t = 4$ s', loc='right')
axF.set_title('$\Delta{}t = 0.5$ s', loc='right')
axG.set_title('$\Delta{}t = 1$ s', loc='right')
axH.set_title('$\Delta{}t = 2$ s', loc='right')
axI.set_title('$\Delta{}t = 4$ s', loc='right')
#axB.tick_params(which='minor', left=True, axis='y')
#axF.tick_params(which='minor', left=True, axis='y')
axG.tick_params(which='minor', left=True, axis='y')
sns.despine(offset=3, trim=False);
plt.tight_layout()
os.chdir('C:\\Users\\Viva\\Desktop\\EPJ folder\\paperfigures')
try:
plt.savefig('vanhove,janus,' + moviename + '.pdf',
bbox_inches='tight', figsize=(thiswidth, thisheight))
plt.savefig('vanhove,janus,' + moviename + '.svg',
bbox_inches='tight', figsize=(thiswidth, thisheight))
print('pdf saved')
plt.savefig('vanhove,janus,' + moviename + '.png',
bbox_inches='tight', dpi=600, figsize=(thiswidth, thisheight))
except IOError:
print('Close the pdf file so I can overwrite it.')
In [48]:
#vh4nrx.plot(style = 'b.',label = 'control', ms=myms)
#vh4hrx.plot(style = 'r.',label = 'tracer', ms=myms)
#vh4hgx.plot(style = 'g.',label = 'janus', ms=myms)
# control
vh4nrx.sum()*binwidth
Out[48]:
In [49]:
# janus
vh4hgx.sum()*binwidth
Out[49]:
In [50]:
# tracer
vh4hrx.plot(style = 'r.',label = 'tracer', ms=myms)
vh4hrx.sum()*binwidth
Out[50]:
In [51]:
areaundervh4hrx = vh4hrx.sum()*binwidth
In [52]:
normfactorvh4hrx = 1/areaundervh4hrx
normfactorvh4hrx
Out[52]:
In [53]:
vh4hrxnormed = (1/(vh4hrx.sum()*binwidth))*vh4hrx
In [54]:
vh4hrxnormed.sum()*binwidth
Out[54]:
In [55]:
vh4hrxnormed.plot(style = 'r.',label = 'tracer', ms=myms)
Out[55]:
In [ ]: